<?php
/**
 * Created by andrei
 * Date: 9/19/12
 * Time: 11:18 AM
 */
class Page_Fe_Products_FlashProduct extends Page
{
	/**
	 * @var Db_Products_Products
	 */
	protected $tableObject;

	function __construct() {
		parent::__construct();
	}

	public function defaultAction() {

		$server = new Zend_Amf_Server();
		$server->setClass("ProductsFlashManager");
		$server->setProduction(false);

		$response = $server->handle();

		return array(
			'type' => 'string',
			'content' => $response
		);
	}

	public function uploadImageAction() {

		$flashManagerObj = new ProductsFlashManager();
		return array(
			'type' => 'string',
			'content' => $flashManagerObj->uploadPhoto($_GET,$_FILES)
		);
	}

	public function viewAction() {
		$flashManagerObj = new ProductsFlashManager();
		print_r('<pre>');
		//print_r($flashManagerObj->getData(251, true, false, 1)); // pre order
		//print_r($flashManagerObj->getData(841, false, false, 1)); // get product
		//print_r($flashManagerObj->getDataBySizeId(41));
		//print_r($flashManagerObj->uploadPhoto());
		print_r($flashManagerObj->saveMultiValue());
	}
}

/*
 define('CURRENT_PROJECT_PATH', dirname(__FILE__).'/');
 include_once("../../globals/initialize_cli.php");

 set_include_path(GLOBALS_PATH.'libs/');
 require_once(GLOBALS_PATH.'classes/Products/ProductsFlashManager.class.php');

 if(TEST == true) {
 	$flashManagerObj = new ProductsFlashManager();
 	print_r('<pre>');
 	print_r($flashManagerObj->getData(91,true,true));
 	exit;
 }

 if($_GET['action'] == 'upload') {
 	//case when upload file
 	$flashManagerObj = new ProductsFlashManager();
 	echo $flashManagerObj->uploadPhoto($_GET,$_FILES);
 	//echo 'este';
 } else {

 	require_once(GLOBALS_PATH.'libs/Zend/Amf/Server.php');

 	$server = new Zend_Amf_Server();
 	$server->setClass("ProductsFlashManager");
 	$server->setProduction(false);

 	$response = $server->handle();
 	print $response;
 }
 */